﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Exhibition.Common.CacheManager;
using Exhibition.Dao.ViewModel;
 

namespace Exhibition.Service
{
    public class BaseControl : System.Web.UI.UserControl
    {
        public UserModel lgUser = null;
        public string Suffix = string.Empty;
        public string SiteUrl = string.Empty;
        public SiteModel stmd { get; set; }
        protected override void OnLoad(EventArgs e)
        {
            var userName = HttpContext.Current.User.Identity.Name;

            if (CommonCacheManager.GetCacheData<UserModel>("CurrentUser" + userName)!= null)
            {

                lgUser = CommonCacheManager.GetCacheData<UserModel>("CurrentUser" + userName);
            }
              stmd = CommonCacheManager.GetCacheData<SiteModel>("CurrentSite");
            if (stmd == null)
            {
                stmd = CenterService.siteService.GetCurrentSite();
                CommonCacheManager.AddCacheData<SiteModel>("CurrentSite", stmd, 180);
                 
            }
            base.OnLoad(e);

        }
        public string BuildUrl(string apath) {
            return "http://"+apath + Suffix;
        }


         
        
        
 
    }
}
